using System;
using System.Collections;
using System.Text;

namespace CustomSecurity
{
    public sealed class CustomIdentity : System.Security.Principal.IIdentity
    {
        #region User property
        private User _User;
        public User User
        {
            get
            {
                return _User;
            }
            set
            {
                _User = value;
            }
        }
        #endregion

        public CustomIdentity(User user)
        {
            if (user == null) throw new ArgumentNullException("name", "Argument must not be null");
            _User = user;
        } // End CustomIdentity()
       
        #region IIdentity implementation
        public bool IsAuthenticated
        {
            get { return true; }
        } 

        public string AuthenticationType
        {
            get { return "Custom"; }
        }
        
        public string Name
        {
            get { return _User.UserName; }
        } 
        #endregion

    } 
}
